package hc.bre.func

import hc.bre.ComponentConfig
import hc.bre.cmn.IDetailList
import hc.bre.cmn.ListOption
import hc.bre.cmn.RuleScriptBuilder
import hc.bre.cmn.RuleDefinition
import hc.bre.script.ImportItem

@groovy.transform.CompileStatic
@groovy.transform.ToString(includeNames=true,includePackage=false)
class FunctionDefinition  extends RuleDefinition implements IDetailList<FunctionItem>{
	public static final ComponentConfig _config ;
	static {
		_config = new ComponentConfig();
		_config.rtype = 'function';
		_config.rname = '自定义函数';
		_config.builderClass = FunctionBuilder;
		_config.homepage = '/rule/script/functionhome.htm' ;
		_config.description = '''
''';
	};

	List<ImportItem> imports =[]
	List<FunctionItem> list =[]

	FunctionDefinition() {
		this.rname = _config.rname;
	}

	@Override
	public FunctionDefinition load(Map map) {
		super.load(map);

		imports = hc.Util.loadList(map['imports'], ImportItem.class)

		list = hc.Util.loadList(map['list'], FunctionItem.class)

		return this;
	}

//	@Override
//	public <T extends RuleScriptBuilder> Class<T> scriptBuilderClass() {
//		return FunctionBuilder.class;
//	}
}
